﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Activities;
using HybridLab.Workflow.Activities.Info;
using HybridLab.Virtual.Interfaces;
using Microsoft.TeamFoundation.Build.Client;

namespace HybridLab.Workflow.Activities.CodeActivities
{
	[BuildActivity(HostEnvironmentOption.All)]
	public sealed class CreateVMSnapshotActivity : CodeActivity
	{
		public InArgument<IVirtualMachine> Machine { get; set; }
		public InArgument<string> SnapshotPrefix { get; set; }

		protected override void Execute(CodeActivityContext context)
		{
			var machine = context.GetValue(Machine);
			var prefix = context.GetValue(SnapshotPrefix);

			context.LogMessage("Creating snapshot on machine {0}", machine.Name);
			machine.CreateSnapshot(prefix);
		}
	}
}
